* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #8b5cf6;
  --primary-dark: #7c3aed;
  --secondary: #6366f1;
  --success: #10b981;
  --error: #ef4444;
  --background: #0f0f1a;
  --surface: #1a1a2e;
  --surface-light: #252538;
  --text: #ffffff;
  --text-secondary: #a1a1aa;
  --border: #2d2d44;
  
  /* 圆角变量 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* 认证页面样式 */
.auth-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 40px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--background);
  padding: 4px;
  border-radius: 8px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.3s;
}

.tab-btn.active {
  background: var(--primary);
  color: var(--text);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: var(--text);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-light);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:disabled:hover {
  transform: none;
}

.error-message {
  margin-top: 12px;
  padding: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error);
  border-radius: 8px;
  color: var(--error);
  font-size: 14px;
  display: none;
}

.error-message.show {
  display: block;
}

/* 导航栏样式 */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-menu {
  display: flex;
  gap: 24px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-user span {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 容器样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.3s, border-color 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.stat-icon {
  font-size: 32px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* 推荐部分 */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 24px;
}

.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.recommendation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.3s, border-color 0.3s;
  cursor: pointer;
}

.recommendation-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.recommendation-card h3 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--primary);
}

.recommendation-card .translation {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.recommendation-card .recommendation-reason {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
  display: inline-block;
  border: 1px solid var(--primary-light);
}

.recommendation-card .meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.difficulty-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.difficulty-1 {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.difficulty-2 {
  background: rgba(139, 92, 246, 0.2);
  color: var(--primary);
}

.difficulty-3 {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

/* 快速开始 */
.quick-start-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.option-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.option-card h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.option-card p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* 学习页面 */
.learning-container {
  max-width: 800px;
  margin: 0 auto;
}

.learning-header {
  margin-bottom: 40px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s;
}

.learning-stats {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.word-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
}

.word-display h1 {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--primary);
}

.phonetic {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.pos {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.answer-section {
  max-width: 400px;
  margin: 0 auto;
}

.answer-section input {
  width: 100%;
  padding: 16px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 16px;
  text-align: center;
}

.answer-section input:focus {
  outline: none;
  border-color: var(--primary);
}

.answer-section button {
  width: 100%;
  margin-bottom: 12px;
}

.feedback-section {
  margin-top: 32px;
}

.feedback-section.hidden {
  display: none;
}

.feedback-message {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.feedback-message.correct {
  color: var(--success);
}

.feedback-message.incorrect {
  color: var(--error);
}

.correct-answer {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.session-complete {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
}

.session-complete.hidden {
  display: none;
}

.session-complete h2 {
  font-size: 32px;
  margin-bottom: 24px;
  color: var(--success);
}

.session-stats {
  margin-bottom: 32px;
}

.session-stats p {
  font-size: 18px;
  margin-bottom: 12px;
}

.session-stats span {
  color: var(--primary);
  font-weight: 700;
}

/* 统计页面 */
.stats-period {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  align-items: center;
  flex-wrap: wrap;
}

.period-btn {
  padding: 10px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
}

.period-btn.active {
  background: var(--primary);
  color: var(--text);
  border-color: var(--primary);
}

.statistics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card-large {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.stat-card-large h3 {
  font-size: 20px;
  margin-bottom: 20px;
}

.stat-details p {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.stat-details span {
  color: var(--text);
  font-weight: 600;
}

.chart-container {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.records-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.record-item {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.record-item:last-child {
  border-bottom: none;
}

.record-word {
  font-weight: 600;
  color: var(--primary);
}

.record-result {
  font-size: 14px;
  color: var(--text-secondary);
}

.record-result.correct {
  color: var(--success);
}

.record-result.incorrect {
  color: var(--error);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 16px;
  }

  .nav-menu {
    width: 100%;
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .recommendations-grid {
    grid-template-columns: 1fr;
  }

  .statistics-grid {
    grid-template-columns: 1fr;
  }

  .word-card {
    padding: 40px 20px;
  }

  .word-display h1 {
    font-size: 36px;
  }
}

.hidden {
  display: none !important;
}

/* 选择题样式 */
.choice-section {
  margin-top: 30px;
}

.choice-question {
  text-align: center;
  margin-bottom: 30px;
}

.choice-question h3 {
  color: var(--text-primary);
  font-size: 18px;
  margin: 0;
}

.choice-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.choice-option {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  font-size: 16px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.choice-option:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.choice-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.choice-option.correct-answer {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

.choice-option.wrong-answer {
  border-color: var(--error);
  background: var(--error-light);
  color: var(--error);
}

/* 翻译题样式 */
.translation-section {
  margin-top: 30px;
}

/* 浏览模式样式 */
.browse-section {
  margin-top: 30px;
}

.word-info {
  text-align: center;
  margin-bottom: 30px;
}

.word-translation h3 {
  font-size: 24px;
  color: var(--text);
  margin-bottom: 20px;
  padding: 20px;
  background: var(--surface-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.word-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.detail-item .label {
  font-weight: 500;
  color: var(--text-secondary);
}

.detail-item .recommendation-score {
  color: var(--primary);
  font-weight: 600;
}

.detail-item .recommendation-reason {
  color: var(--text);
  font-style: italic;
}

.browse-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
}

.browse-actions .btn {
  min-width: 120px;
}

/* 响应式设计 - 选择题 */
@media (max-width: 768px) {
  .choice-options {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .choice-option {
    padding: 15px;
    font-size: 14px;
    min-height: 50px;
  }
  
  .browse-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .browse-actions .btn {
    width: 100%;
    max-width: 200px;
  }
  
  .word-details {
    max-width: 100%;
  }
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--surface-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 26, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-overlay .loading-spinner {
  width: 50px;
  height: 50px;
  border-width: 4px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  font-size: 14px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  max-width: 400px;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--error);
}

.toast.info {
  border-color: var(--primary);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
